/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/two-sum-ii-input-array-is-sorted
   @Language: C++
   @Datetime: 19-11-27 15:41
   */

class Solution {
public:
	vector<int> twoSum(vector<int>& numbers, int target) {
		for(int i=0, j=numbers.size()-1; i<j;){
			const int sum = numbers[i]+numbers[j];
			if(sum==target) return {i+1,j+1};
			else if(sum>target) --j;
			else ++i;
		}
		return {0,0};
	}
};
